<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script>
			let peolple = {}
			
			let value = '张三'

			Object.defineProperty(peolple, 'name', {
				// value:'王二',
				// writable:false,
				get() {
					console.log('get')
					return value
				},
				set(newValue) {
					console.log('set' + newValue)
					value = newValue
				}
			})
			peolple.name = '李四'

			console.log('结果：',peolple.name)

			// let peolple = {}

			// Object.defineProperty(peolple,'name',{
			// 	value:'a',
			// 	writable: false
			// })
			// console.log(peolple.name)

			// Object.defineProperty(Person, 'name', {
			// 	value: 'a',
			// 	writable: false
			// })
			// Person.name = 'b'
			// console.log(Person.name); //a
		</script>
	</body>
</html>